//
//  JMZujiCell.m
//  VoluntaryStar
//
//  Created by xiaorui on 15/9/1.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "JMZujiCell.h"
#import "UIViewExt.h"
#import "NSString+date.h"
#import "JMHeader.h"

@implementation JMZujiCell

- (UIImageView *)iconImageView
{
    if (!_iconImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.image = [UIImage imageNamed:@"imageName"];
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        _iconImageView = imageView;
    }
    
    return _iconImageView;
}
- (UILabel *)nameLabel
{
    if (!_nameLabel) {
        UILabel* label = [[UILabel alloc]init];
        label.backgroundColor = [UIColor clearColor];
        label.textColor = [UIColor blackColor];
        label.font = [UIFont systemFontOfSize:14.0f];
        _nameLabel = label;
    }
    return _nameLabel;
}

- (UIImageView *)addressImageView
{
    if (!_addressImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.image = [UIImage imageNamed:@"projectImage.bundle/location_image"];
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        _addressImageView = imageView;
    }
    return _addressImageView;
}

- (UILabel *)addressLabel
{
    if (!_addressLabel) {
        UILabel* label = [[UILabel alloc]init];
        label.backgroundColor = [UIColor clearColor];
        label.textColor = [UIColor blackColor];
        label.font = [UIFont systemFontOfSize:12.0f];
        label.textColor = UIColorFromRGB(0xc4c4c4);
        _addressLabel = label;
    }
    return _addressLabel;
}

- (UIImageView *)shoolImageView
{
    if (!_shoolImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.image = [UIImage imageNamed:@"projectImage.bundle/schoo_imagel"];
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        imageView.transform = CGAffineTransformMakeRotation(-M_PI_4);
        _shoolImageView = imageView;
    }
    return _shoolImageView;
}

- (UILabel *)shoolLabel
{
    if (!_shoolLabel) {
        UILabel* label = [[UILabel alloc]init];
        label.backgroundColor = [UIColor clearColor];
        label.textColor = [UIColor blackColor];
        label.font = [UIFont systemFontOfSize:12.0f];
        label.textColor = UIColorFromRGB(0xc4c4c4);
        _shoolLabel = label;
    }
    return _shoolLabel;
}


- (UIImageView *)gradeImageView
{
    if (!_gradeImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.image = [UIImage imageNamed:@"projectImage.bundle/grade_image"];
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        _gradeImageView = imageView;
    }
    return _gradeImageView;
}
- (UILabel *)gradeLabel
{
    if (!_gradeLabel) {
        UILabel* label = [[UILabel alloc]init];
        label.backgroundColor = [UIColor clearColor];
        label.textColor = [UIColor blackColor];
        label.font = [UIFont systemFontOfSize:12.0f];
        label.textColor = UIColorFromRGB(0xc4c4c4);
        _gradeLabel = label;
    }
    return _gradeLabel;
}


-(void)layoutSubviews{
    [super layoutSubviews];
    self.iconImageView.frame =CGRectMake(UI_SCREEN_WITH * 0.046875, (self.frameHeight - UI_SCREEN_WITH * 0.2053)/2.0, UI_SCREEN_WITH * 0.2053, UI_SCREEN_WITH * 0.2053);
    self.iconImageView.layer.masksToBounds = YES;
    self.iconImageView.layer.cornerRadius = UI_SCREEN_WITH * 0.2053/2.0;
    self.iconImageView.layer.borderWidth = 0.1;
    self.iconImageView.backgroundColor = [UIColor clearColor];
    [self addSubview:self.iconImageView];
    
    self.nameLabel.frame = CGRectMake(self.iconImageView.frameRight + 5, self.iconImageView.frameTop + 3, 36, 25);
    [self addSubview:self.nameLabel];
    
    self.addressImageView .frame = CGRectMake(self.nameLabel.frameRight + 5, self.nameLabel.center.y  -  UI_SCREEN_WITH *0.0375/2.0 + 1,UI_SCREEN_WITH *0.0375, UI_SCREEN_WITH *0.0375);
    [self addSubview:self.addressImageView];
    
    self.addressLabel.frame = CGRectMake(self.addressImageView.frameRight + 3, self.addressImageView.frameTop, UI_SCREEN_WITH * 0.078125, self.nameLabel.frameHeight);
    [self addSubview:self.addressLabel];
    self.shoolImageView.frame =CGRectMake(self.nameLabel.frameLeft, self.iconImageView.center.y - UI_SCREEN_WITH *0.0355/2.0, UI_SCREEN_WITH *0.0355, UI_SCREEN_WITH *0.0355);
    [self addSubview:self.shoolImageView];
    self.shoolLabel.frame =CGRectMake(self.shoolImageView.frameRight + 8, self.iconImageView.center.y - self.nameLabel.frameHeight/2.0, UI_SCREEN_WITH *0.30625, self.nameLabel.frameHeight);
    [self addSubview:self.shoolLabel];
    
    
    self.gradeImageView.frame = CGRectMake(self.nameLabel.frameLeft, self.iconImageView.frameBottom - self.nameLabel.frameHeight - 1, UI_SCREEN_WITH *0.0375, UI_SCREEN_WITH *0.0375);
    [self addSubview:self.gradeImageView];
    
    self.gradeLabel.frame = CGRectMake(self.gradeImageView.frameRight + 8, self.gradeImageView.frameTop, UI_SCREEN_WITH *0.30625, self.nameLabel.frameHeight);
    [self addSubview:self.gradeLabel];
}


- (void)awakeFromNib {

}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
